home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / amiga utilities / communication / internet / amitcp3.0b / netinclude / clib / socket_protos.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-21  |  4.7 KB  |  171 lines

  1. #ifndef CLIB_SOCKET_PROTOS_H
  2. #define CLIB_SOCKET_PROTOS_H
  3.  
  4. /*
  5.  * $Id: socket_protos.h,v 3.5 1994/01/20 02:40:08 jraja Exp $
  6.  * $Release$
  7.  *
  8.  * Prototypes of AmiTCP/IP bsdsocket.library
  9.  * 
  10.  * Copyright © 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
  11.  *                  Helsinki University of Technology, Finland.
  12.  *                  All rights reserved.
  13.  */
  14.  
  15. #ifndef EXEC_TYPES_H
  16. #include <exec/types.h>
  17. #endif
  18.  
  19. #ifndef SYS_TYPES_H
  20. #include <sys/types.h>
  21. #endif
  22.  
  23. #ifndef SYS_TIME_H
  24. #include <sys/time.h>
  25. #endif
  26.  
  27. #ifndef SYS_SOCKET_H
  28. #include <sys/socket.h>
  29. #endif
  30.  
  31. #ifndef IN_H
  32. #include <netinet/in.h>
  33. #endif
  34.  
  35. #ifndef AMITCP_NEW_NAMES
  36. #define STDSOCKAPI
  37. #define Socket socket
  38. #define Bind bind
  39. #define Listen listen
  40. #define Accept accept
  41. #define Connect connect
  42. #define Send send
  43. #define SendTo sendto
  44. #define SendMsg sendmsg
  45. #define Recv recv
  46. #define RecvFrom recvfrom
  47. #define RecvMsg recvmsg
  48. #define Shutdown shutdown
  49. #define SetSockOpt setsockopt
  50. #define GetSockOpt getsockopt
  51. #define GetSockName getsockname
  52. #define GetPeerName getpeername
  53. #define Inet_Addr inet_addr
  54. #define Inet_Network inet_network
  55. #define GetHostByName gethostbyname
  56. #define GetHostByAddr gethostbyaddr
  57. #define GetNetByName getnetbyname
  58. #define GetNetByAddr getnetbyaddr
  59. #define GetServByName getservbyname
  60. #define GetServByPort getservbyport
  61. #define GetProtoByName getprotobyname
  62. #define GetProtoByNumber getprotobynumber
  63. #define GetDTableSize getdtablesize
  64. #define GetHostName gethostname
  65. #define GetHostId gethostid
  66. #define SyslogA vsyslog
  67. #define Syslog syslog
  68. #endif
  69.  
  70. LONG Socket(LONG domain, LONG type, LONG protocol);
  71. LONG Bind(LONG s, const struct sockaddr *name, LONG namelen);
  72. LONG Listen(LONG s, LONG backlog);
  73. LONG Accept(LONG s, struct sockaddr *addr, LONG *addrlen);
  74. LONG Connect(LONG s, const struct sockaddr *name, LONG namelen);
  75. LONG Send(LONG s, const UBYTE *msg, LONG len, LONG flags);
  76. LONG SendTo(LONG s, const UBYTE *msg, LONG len, LONG flags, 
  77.           const struct sockaddr *to, LONG tolen);
  78. LONG SendMsg(LONG s, struct msghdr * msg, LONG flags);
  79. LONG Recv(LONG s, UBYTE *buf, LONG len, LONG flags);    /* V3 */
  80. LONG RecvFrom(LONG s, UBYTE *buf, LONG len, LONG flags, 
  81.             struct sockaddr *from, LONG *fromlen);
  82. LONG RecvMsg(LONG s, struct msghdr * msg, LONG flags);    /* V3 */
  83. LONG Shutdown(LONG s, LONG how);
  84. LONG SetSockOpt(LONG s, LONG level, LONG optname, 
  85.              const void *optval, LONG optlen);
  86. LONG GetSockOpt(LONG s, LONG level, LONG optname, 
  87.              void *optval, LONG *optlen);
  88. LONG GetSockName(LONG s, struct sockaddr *name, LONG *namelen);
  89. LONG GetPeerName(LONG s, struct sockaddr *name, LONG *namelen);
  90.  
  91. LONG IoctlSocket(LONG d, ULONG request, char *argp);
  92. LONG CloseSocket(LONG d);
  93. LONG WaitSelect(LONG nfds, fd_set *readfds, fd_set *writefds, fd_set *exeptfds,
  94.         struct timeval *timeout, ULONG *maskp);
  95.  
  96. LONG Dup2Socket(LONG fd1, LONG fd2);               /* V2 */
  97.  
  98. LONG GetDTableSize(void);                   /* V3 */
  99. void SetSocketSignals(ULONG SIGINTR, ULONG SIGIO, ULONG SIGURG);
  100. LONG SetErrnoPtr(void *errno_p, LONG size);
  101. LONG SocketBaseTagList(struct TagItem *tagList);    /* V3 */
  102. LONG SocketBaseTags(...);                /* V3 */
  103.  
  104. LONG Errno(void);
  105.  
  106. LONG GetHostName(STRPTR hostname, LONG size);          /* V3 */
  107. ULONG GetHostId(void);                       /* V3 */
  108.  
  109. LONG ObtainSocket(LONG id, LONG domain, LONG type, LONG protocol);
  110. LONG ReleaseSocket(LONG fd, LONG id);
  111. LONG ReleaseCopyOfSocket(LONG fd, LONG id);
  112.  
  113. /* Arpa/inet functions */
  114. ULONG Inet_Addr(const UBYTE *);
  115. ULONG Inet_Network(const UBYTE *);
  116. char *Inet_NtoA(ULONG s_addr);
  117. ULONG Inet_MakeAddr(ULONG net, ULONG lna);
  118. ULONG Inet_LnaOf(LONG s_addr);
  119. ULONG Inet_NetOf(LONG s_addr);
  120.  
  121. /* NetDB functions */
  122. struct hostent  *GetHostByName(const UBYTE *name);
  123. struct hostent  *GetHostByAddr(const UBYTE *addr, LONG len, LONG type);
  124. struct netent   *GetNetByName(const UBYTE *name);
  125. struct netent   *GetNetByAddr(LONG net, LONG type);
  126. struct servent  *GetServByName(const UBYTE *name, const UBYTE *proto);
  127. struct servent  *GetServByPort(LONG port, const UBYTE *proto);
  128. struct protoent *GetProtoByName(const UBYTE *name);
  129. struct protoent *GetProtoByNumber(LONG proto);
  130.  
  131. /* Syslog functions */
  132. void SyslogA(ULONG pri, const char *fmt, LONG *);
  133. void Syslog(ULONG pri, const char *fmt, ...);
  134.  
  135. #ifdef STDSOCKAPI
  136. #undef STDSOCKAPI
  137. #undef Socket
  138. #undef Bind
  139. #undef Listen
  140. #undef Accept
  141. #undef Connect
  142. #undef Send
  143. #undef SendTo
  144. #undef SendMsg
  145. #undef Recv
  146. #undef RecvFrom
  147. #undef RecvMsg
  148. #undef Shutdown
  149. #undef SetSockOpt
  150. #undef GetSockOpt
  151. #undef GetSockName
  152. #undef GetPeerName
  153. #undef Inet_Addr
  154. #undef Inet_Network
  155. #undef GetHostByName
  156. #undef GetHostByAddr
  157. #undef GetNetByName
  158. #undef GetNetByAddr
  159. #undef GetServByName
  160. #undef GetServByPort
  161. #undef GetProtoByName
  162. #undef GetProtoByNumber
  163. #undef GetDTableSize
  164. #undef GetHostName
  165. #undef GetHostId
  166. #undef SyslogA
  167. #undef Syslog
  168. #endif
  169.  
  170. #endif /* !CLIB_SOCKET_PROTOS_H */
  171.